package com.drp.dao;

import com.drp.bean.Goods;
import com.drp.bean.Market;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.drp.bean.Market2;
import com.drp.provider.MarketProvider;
import lombok.Data;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ren
 * @since 2022-03-16
 */
public interface MarketMapper extends BaseMapper<Market> {
    @Select("SELECT m_id,m_name,m_number,m_sole,m_factory FROM t_market2")
    @Results(id = "marketMap",value = {
            @Result(column = "m_id",property = "m_id"),
            @Result(column = "m_name",property = "m_name"),
            @Result(column = "m_number",property = "m_number"),
            @Result(column = "m_sole",property = "m_sole"),
            @Result(column = "m_factory",property = "m_factory")
    })
    List<Market2> selectMarket();
    @Insert("insert into t_market2(m_name,m_number,m_sole,m_factory)value(#{m_name},#{m_number},#{m_sole},#{m_factory})")
    int insertMarket2(Market2 market2);
    @SelectProvider(value = MarketProvider.class,method = "lookMarket")
    List<Goods> selectGoods(String name,String kind);
    @Update("update  t_market2 set m_number=#{number} where m_id=#{id}")
    int updateMarket2(@Param("id") String id,@Param("number") String number);
    @Update("update  t_market2 set m_number=(m_number+#{number}) where m_id=#{id}")
    int updateMarket2byId(@Param("id") String id,@Param("number") String number);
    @Delete("delete from t_market2 where m_id=#{id}")
    int delMarket2ById(String id);
    @Delete("delete from t_market2 ")
    int delMarket2();

}
